package com.leadingsoft.pwxk.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.leadingsoft.pwxk.converter.AuditCertConverster;
import com.leadingsoft.pwxk.dto.AuditCertDto;
import com.leadingsoft.pwxk.model.AuditCert;
import com.leadingsoft.pwxk.service.AuditCertService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 * @author ysh
 * @desc 审批信息-发证信息
 */
@Api(description = "审批信息-发证信息")
@RestController
@RequestMapping("api/auditCert")
public class AuditCertController {

	@Autowired
	AuditCertService auditCertService;

	@Autowired
	AuditCertConverster auditCertConverster;

	@ApiOperation("审批信息-发证信息详情")
	@GetMapping(path = "{dataid}")
	@ResponseStatus(code = HttpStatus.OK)
	public AuditCertDto get(@PathVariable(value = "dataid") String dataId) {
		return auditCertService.getOne(dataId);
	}

	@ApiOperation("审批信息-发证审批信息")
	@GetMapping(value = "spyj")
	@ResponseStatus(code = HttpStatus.OK)
	public AuditCertDto getSpyj(@RequestParam(value = "dataid") String dataId) {
		AuditCert auditCert = auditCertService.getByDataId(dataId);
		return auditCertConverster.toDto(auditCert);
	}

}
